package com.briercliffe.settlers.core.domain;

/**
* User: briercliffe
* Date: 10/21/13
*/
public class AxialCoordinates
{
    public static AxialCoordinates fromCubeCoordinates(final CubeCoordinates iCubeCoordinates)
    {
        AxialCoordinates axialCoordinates = new AxialCoordinates();
        axialCoordinates.setQ(iCubeCoordinates.getX());
        axialCoordinates.setR(iCubeCoordinates.getZ());
        return axialCoordinates;
    }

    private int mQ;
    private int mR;

    public AxialCoordinates()
    {

    }

    public AxialCoordinates(final int iQ, final int iR)
    {
        mQ = iQ;
        mR = iR;
    }

    public AxialCoordinates getNeighbor(final BoardLayout.Direction iDirection)
    {
        return new AxialCoordinates(mQ + iDirection.getQ(),
                                    mR + iDirection.getR());
    }

    public CubeCoordinates convertToCube() {
        return new CubeCoordinates(mQ, (-mQ-mR), mR);
    }

    public int getQ()
    {
        return mQ;
    }

    public void setQ(final int iQ)
    {
        mQ = iQ;
    }

    public int getR()
    {
        return mR;
    }

    public void setR(final int iR)
    {
        mR = iR;
    }
}
